﻿using FreeSql.DataAnnotations;
using Jumei.Common.BaseModel;
using Jumei.Model.Admin;
using Jumei.Model.Business.MemberManage;
using System;

namespace Jumei.Model.Business.OrdersManage
{
    /// <summary>
    /// 订单投诉表
    /// </summary>
    [Table(Name = "or_order_complains")]
    [Index("idx_{tablename}_01", nameof(Complain), false)]
    public class OrderComplainsEntity : EntityFull, ITenant
    {
        /// <summary>
        /// 租户Id
        /// </summary>
        [Column(Position = -10)]
        public long? TenantId { get; set; }

        /// <summary>
        /// 订单ID
        /// </summary>
        public long OrdersId { get; set; }

        public OrdersEntity Orders { get; set; }

        /// <summary>
        /// 投诉类型
        /// </summary>
        [Column(MapType = typeof(int))]
        public ComplainType Complain { get; set; }

        /// <summary>
        /// 投诉人ID
        /// </summary>
        public long ComplainTargetId { get; set; }

        public MemberEntity Member { get; set; }

        /// <summary>
        /// 应诉人ID 如果是店铺则为店铺ID
        /// </summary>
        public long RespondTargetId { get; set; }

        /// <summary>
        /// 是否需要应付
        /// </summary>
        public bool NeedRespond { get; set; } = false;

        /// <summary>
        /// 移交应诉时间
        /// </summary>
        public DateTime? DeliverRespondTime { get; set; }

        /// <summary>
        /// 投诉内容
        /// </summary>
        [Column(StringLength = -2)]
        public string ComplainContent { get; set; }

        /// <summary>
        /// 投诉附件 最多5张图片
        /// </summary>
        [Column(StringLength = 500)]
        public string ComplainAnnex { get; set; }

        /// <summary>
        /// 投诉状态
        /// </summary>
        [Column(MapType = typeof(int))]
        public ComplainStatusType ComplainStatus { get; set; } = 0;

        /// <summary>
        /// 应诉内容
        /// </summary>
        [Column(StringLength = -2)]
        public string RespondContent { get; set; }

        /// <summary>
        /// 应付附件
        /// </summary>
        [Column(StringLength = 500)]
        public string RespondAnnex { get; set; }

        /// <summary>
        /// 应诉时间    
        /// </summary>
        public DateTime? respondTime { get; set; }

        /// <summary>
        /// 仲裁结果
        /// </summary>
        [Column(StringLength = -2)]
        public string FinalResult { get; set; }

        /// <summary>
        /// 仲裁时间        
        /// </summary>
        public DateTime? FinalResultTime { get; set; }

        /// <summary>
        /// 仲裁人ID
        /// </summary>
        public long FinalHandleStaffId { get; set; }

        public UserEntity FinalHandleStaff { get; set; }
    }
}
